package ks.server.controllers.requests;

import org.w3c.dom.Document;

import ks.framework.common.Message;
import ks.framework.communicator.Communicator;
import ks.managers.table.Table;

public class TableOptionsRequest {
	private Communicator com;
	
	public TableOptionsRequest(Communicator c) {
		this.com = c;
	}
	
	public boolean send(Table table) {
		StringBuilder sb = new StringBuilder("<request version=\"1.0\" id=\"12345\">");
		sb.append("<table-options id=\"" + table.getId() + "\" time=\"\" plugin=\"\" undo=\"\" newhand=\"\"/>");
		sb.append("</request>");
		
		Document d = Message.construct(sb.toString());
		Message r = new Message(d);
		r.setBroadcast();
		return com.distribute(r);
	}
}